# Build recipe for hwids.
#
# Copyright (c) 2017-2018 Matias Fonzo, <selk@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

program=hwids
version=20180315
arch=noarch
release=1

tarname=${program}-${version}.tar.gz

# Remote source(s)
fetch=http://github.com/gentoo/hwids/archive/$tarname

description="
Hardware identification databases.

This package contain a specially re-packaged copy of the pci.ids
and usb.ids files, as well as a copy of IEEE's databases for the
Organizationally Unique Identifiers (OUI) and Individual Address
Block (IAB).
"

homepage=http://github.com/gentoo/hwids
license="GPLv2+ | 3-clause BSD"

# Source documentation
docs="README.md *.txt"
docsdir="${docdir}/${program}-${version}"

# Custom source directory name
srcdir=hwids-hwids-${version}

build()
{
    set -e

    unpack "${tardir}/$tarname"

    cd "$srcdir"

    mkdir -p "${destdir}/usr/share/hwdata"

    for file in *.ids
    do
        cp -p $file "${destdir}/usr/share/hwdata/"
        chmod 644 "${destdir}/usr/share/hwdata/${file}"
    done

    # Copy documentation
    mkdir -p "${destdir}${docsdir}"
    cp -p $docs "${destdir}${docsdir}"
}

